/**
 * 
 */
package com.kingre.et.action;

import java.io.IOException;

import javax.mail.MessagingException;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;

import com.kingre.et.service.IUserService;
import com.opensymphony.xwork2.ActionSupport;

/**
 * @author Jingui Yu
 * 
 */
public class ActiveRegistAction extends ActionSupport {
    private static final long serialVersionUID = -3043709642379161187L;
    private static final Logger logger = Logger.getLogger(ActiveRegistAction.class);
    @Autowired
    private IUserService userService;

    private Integer uid;
    private String email;
    private String password;

    public String execute() throws IOException, MessagingException {
        logger.debug("activeRegist------------------<<");
        logger.debug("uid =" + uid);
        logger.debug("email =" + email);
        password = userService.activeRegister(uid, email);
        if (password == null)
            return INPUT;
        else
            return SUCCESS;
    }

    public String insertData() {
        // userService.insertData();
        return SUCCESS;
    }

    public void setUid(String uid) {
        this.uid = Integer.parseInt(uid);
    }

    public void setEmail(String email) {
        this.email = email.replace("$", "@");
    }

    public String getEmail() {
        return email;
    }

    public String getPassword() {
        return password;
    }
}
